#include <stdio.h>

int main(int argc, char *argv[])
{
	int m, n, a[11], t1, t2, min, i;
	for (i=1; i<=10; i++) {
		a[i] = 0;
	}

	scanf("%d %d", &n, &m);
	for (i=0; i<m; i++) {
		scanf("%d %d", &t1, &t2);
		a[t1]++; a[t2]++;
	}

	min = a[1];
	for (i=2; i<=n; i++) {
		if (a[i] < min && a[i] > 0) {
			min = a[i];
		}
	}

	printf("%d\n", min);

	return 0;
}
